package org.eclipse.jdt.internal.ui.callhierarchy;

public class AutoLoadTemplate implements Template {

	public String createTemplateContent() {
		StringBuilder template = new StringBuilder();
		
		template.append("if (isLoaded(\"@fieldName\", this.@fieldName)) {\n");
		template.append("\t\t\treturn this.@fieldName;\n");
		template.append("\t\t}\n");
		template.append("\t\t\n");
		template.append("\t\tthis.@fieldName = ((@fieldType) loadRelAttr(\"@fieldName\"));\n");
		template.append("\t\tLoaded(\"@fieldName\");\n");
		template.append("\t\t\n");
		template.append("\t\treturn this.@fieldName;");
		
		return template.toString();
	}

	public TemplateFlag getTemplateFlag() {
		return TemplateFlag.AUTO_LOAD;
	}

}
